//
//  HJComposeButton.swift
//  zhangmiSinweibo
//
//  Created by zhangmi on 16/5/29.
//  Copyright © 2016年 Paramount Pictures. All rights reserved.
//

import UIKit

private let imageHeight: CGFloat = 80

class HJComposeButton: UIButton {
    
    //添加模型
    var composeItem: HJComposeItem? {
        didSet {
            setImage(UIImage(named: composeItem?.icon ?? ""), forState: .Normal)
            setTitle(composeItem?.title, forState: .Normal)
            
            titleLabel?.textAlignment = .Center
            titleLabel?.font = UIFont.systemFontOfSize(14)
            setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        }
    }
    

    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: imageHeight,width: imageHeight, height:  contentRect.height - imageHeight)
     }
    
    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: imageHeight, height:  imageHeight)
    }


}
